<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>用户注册</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<link href="${pageContext.request.contextPath}/statics/css/common.css" rel="stylesheet" type="text/css" />
	<link href="${pageContext.request.contextPath}/statics/css/style.css" rel="stylesheet" type="text/css" />
	
	<script type="text/javascript" src="${pageContext.request.contextPath}/statics/js/jquery-1.8.3.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/statics/js/register.js"></script>
	
	  <script type="text/javascript">
		<%
			String msg = request.getParameter("msg");
			if("validateCodeError".equals(msg)){
				out.print("alert('验证码错误，请重新输入');");
			}
		%>
	  </script>
  </head>
  
<body>
<div class="wrap">
  <!-- main begin-->
  <form action="${pageContext.request.contextPath}/Sregister" method="post">
      <div class="zclf login logns">
        <h1  class="blue">用户注册</h1>
          <dl>
            <dd>
              <label> <small>*</small>用户名</label>
              <input name="userName" type="text" class="inputh lf" value="" placeholder="用户名要求不低于6个字符" required />
             <div class="lf red laba"><br><%--用户名要求不低于6个字符--%></div>
            </dd>
            <dd>
              <label> <small>*</small>密码</label>
              <input name="userPassword" type="password" class="inputh lf" value="" placeholder="密码要求不低于6个字符" required />
              <div class="lf red laba"><br><%--密码要求不低于6个字符--%></div>
            </dd>
            <dd>
              <label> <small>*</small>身份证号</label>
              <input name="userCardNo" type="text" class="inputh lf" value="" placeholder="身份证号必填(18位)" required />
              <div class="lf red laba"><br><%--身份证号必填--%></div>
            </dd>
            <dd>
              <label> <small>*</small>电话</label>
              <input name="userTel" type="text" class="inputh lf" value="" placeholder="电话号码必填(11位)" required />
              <div class="lf red laba"><br><%--电话号码必填--%></div>
            </dd>
            <dd>
              <label> <small>*</small>住址</label>
              <input name="userAddress" type="text" class="inputh lf" value="" placeholder="XX市XXXX或XX街道XX号" />
            </dd>
            <dd>
              <label> <small>*</small>邮政编码</label>
              <input name="userPostNumber" type="text" class="inputh lf" value="" placeholder="(例)43100" required/>
            </dd>
            <dd class="hegas">
              <label> <small>*</small>验证码</label>
              <input name="inputCode" type="text" class="inputh inputs lf" value="" />
               <span class="wordp lf"><img id="validateCode" src="Number.jsp" width="96" height="27" alt="" /></span>
               <span class="blues lf"><a id="changeCode" href="javascript:void(0);" title="">看不清</a></span>
            </dd>
            <span style="color: red; font-size: 20px">${error }</span>
            <dd class="hegas">
              <label>&nbsp;</label>
               <input name=""  type="checkbox" id="rem_u" checked="checked"  />
              <label for="rem_u" class="labels">我同意<span class="blues">《服务条款》</span></label>
            </dd>
            <dd class="hegas">
              <label>&nbsp;</label>
              <input name="" type="submit" value="立即注册" class="" />
            </dd>
          </dl>
    </div>
   </form>
<!-- main end-->
<!-- footer begin-->

</div>
 <!--footer end-->
<script type="text/javascript">
  $(function(){
    $("form").submit(function(){
      var name = $("input[name='userName']").val();
      var pwd = $("input[name='userPassword']").val();
      var sfz = $("input[name='userCardNo']").val();
      var phone = $("input[name='userTel']").val();
      var email = $("input[name='userPostNumber']").val();
      var pattern = /^\d{5}$/;
      var isok = true;
      if(name.length < 6){
        alert("用户名要求不低于6个字符")
        isok = false;
      }else if(pwd.length < 6){
        alert("密码要求不低于6个字符")
        isok = false;
      }else if(sfz.length != 18){
        alert("身份证号不正确(18位)")
        isok = false;
      }else if(phone.length != 11){
        alert("电话号码不正确(11位)")
        isok = false;
      }else if(!pattern.test(email)){
        alert("邮政编码格式XXXXX(5位)")
        isok = false;
      }
      return isok;
    })

  });
</script>
</body>
</html>
